# Maintainer: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=qt6
pkgname=qt6-qt5compat
pkgver=6.7.2
pkgrel=0
pkgdesc="Module that contains unsupported Qt 5 APIs"
url="https://qt.io/"
arch="all"
license="LGPL-2.1-only AND LGPL-3.0-only AND GPL-3.0-only AND Qt-GPL-exception-1.0"
# icu-data-full: see https://gitlab.alpinelinux.org/alpine/aports/-/issues/13814
# qt6-qt5compat provides the same icu mib apis
depends="icu-data-full"
depends_dev="
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	"
makedepends="$depends_dev
	cmake
	perl
	samurai
	"
subpackages="$pkgname-dev"
options="!check" # No tests
builddir="$srcdir/qt5compat-everywhere-src-${pkgver/_/-}"

case $pkgver in
	*_alpha*|*_beta*|*_rc*) _rel=development_releases;;
	*) _rel=official_releases;;
esac

source="https://download.qt.io/$_rel/qt/${pkgver%.*}/${pkgver/_/-}/submodules/qt5compat-everywhere-src-${pkgver/_/-}.tar.xz"

build() {
	export CFLAGS="$CFLAGS -g1 -flto=auto"
	export CXXFLAGS="$CXXFLAGS -g1 -flto=auto"
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
31da40af3ab0a2283ead3363ee6c94a45018beccb777d2e4188f182d45ffb7e70d97543e22e5f6bc2c13df149676e44e259c8785626c54a4ed8757dcf414b4b0  qt5compat-everywhere-src-6.7.2.tar.xz
"
